package com.learn.micro_mall.repository.convertor.category;

import com.learn.micro_mall.dao.category.model.Category;
import com.learn.micro_mall.domain.entity.category.CategoryEntity;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

@Mapper
public interface CategoryConvert {

    /**
     * 获取该类自动生成的实现类的实例
     * 接口中的属性都是 public static final 的 方法都是public abstract的
     */
    CategoryConvert INSTANCES = Mappers.getMapper(CategoryConvert.class);

    @Mappings({
            @Mapping(source = "categoryId", target = "categoryId.categoryId")
    })
    CategoryEntity toCategory(Category brandEntity);

}
